package Day01;

import java.util.*;

public class Main {

    public ArrayList<Integer> intersection (ArrayList<Integer> nums1, ArrayList<Integer> nums2) {
        ArrayList<Integer> ans = new ArrayList<>();
        HashMap<Integer, Integer> hash = new HashMap<>();
        for(Integer e : nums1){
            hash.put(e, hash.getOrDefault(e, 0) + 1);
        }
        for(Integer e : nums2){
            if(hash.get(e) != null && hash.get(e) > 0){
                ans.add(e);
                hash.put(e, hash.get(e) - 1);
            }
        }
        int[] ret = new int[ans.size()];
        for(int i =0; i < ret.length; i++){
            ret[i] = ans.get(i);
        }
        return ret;
    }

    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int cnt = 0;
        for(int i = l; i <= r; i++){
            int tmp = i;
            while(tmp > 0){
                if(tmp % 10 == 2)
                    cnt++;
                tmp /= 10;
            }
        }
        System.out.println(cnt);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        char[] arr = str.toCharArray();
        Stack<Character> st = new Stack<>();
        for(char e : arr){
            if(st.isEmpty()){
                st.add(e);
            }else{
                if(st.peek() == e){
                    st.pop();
                }
            }
        }
        StringBuilder sb = new StringBuilder();
        for(Character e : st){
            sb.append(e);
        }
        System.out.println(sb.toString());
    }
}
